<?php

namespace App\Models\Mall;

use Illuminate\Database\Eloquent\Model;

class MallMaster extends Model
{

    protected $table = 'mall_master';

    protected $primaryKey = 'mallID';

    public $timestamps = false;

    public static function getCache($id = 0)
    {

        if (!ebsig_is_int($id)) {
            return null;
        }

        $mall = redisTransformation(app('redis')->get('GLOBAL_SELECTMALL_' . $id));
        if (!$mall) {
            $mall = self::find($id);
            if (!$mall) {
                return null;
            }
            $mall = $mall->toArray();
            app('redis')->setex('GLOBAL_SELECTMALL_' . $id, 8640000, redisTransformation($mall, 'set'));
        }
        
        return $mall;

    }

}
